<!-- 搜索输入框 -->
<template>
  <div
    class="search"
    ref="container"
    :class="[searchClicked ? 'search-clicked' : 'search-unclicked']"
  >
    <input  v-model="searchContent" />
    <button @click="handleSearch()"></button>
  </div>
</template>

<script>
export default {
  data() {
    return {
        searchClicked:false,
        searchContent:''
    };
  },

  components: {},



  computed: {},

  methods: {
    handleSearch(){
      this.$emit('handleSearch',this.searchContent)
    }
  },
  // watch:{
  //   searchContent(newval){
  //     console.log(newval)
  //   }
  // }
};
</script>
<style>
.search {
  width: 200px;
  height: 34px;
  position: relative;
  border-radius: 17px;
  flex: 1 4 200px;
  transition: all 0.2s;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}
.search-unclicked {
  background-color: #f5f5f5e1;
  border: #f5f5f5 1px solid;
}
.search-clicked {
  background-color: rgba(255, 255, 255, 0.85);
  border: #e3e3e3 1px solid;
}
.search > button {
  border: none;
  border-radius: 17px;
  position: relative;
  width: 34px;
  height: 34px;
  background-position: center;
  background-color: #e9e9e9;
  background-repeat: no-repeat;
  background-size: 20px 20px;
  background-image: url("/static/icon/search.png");
  transition: all 0.2s;
}
.search > button:hover {
  transition: all 0.2s;
  background-color: rgb(4, 143, 250);
}
.search > input {
  border: none;
  outline: none;
  padding: none;
  width: 100px;
  height: 34px;
  display: inline-block;
  position: relative;
  background: none;
  flex: 1 1 100px;
  margin-left: 10px;
}
</style>